﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>延续子流程</title>
    <link href="../../../Comm/Style/CommStyle.css" rel="stylesheet" type="text/css" />
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <!--link href="../../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" /-->

    <link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" />
    <link href="../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script src="../../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <base target="_self" />
    <script src="../../Admin.js"></script>
    <!-- 自己的系统风格统一. -->
    <link href="../../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
    <link href="../../../Style/skin/css/Default.css" rel="stylesheet" />
    <link href="../../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />


    <script type="text/javascript">
        //打开窗体.
        function OpenEasyUiDialogExt(url, title, w, h, isReload) {

            OpenEasyUiDialog(url, "eudlgframe", title, w, h, "icon-property", true, null, null, null, function () {
                if (isReload == true) {
                    Reload();
                }
            });
        }

        //页面启动函数.
        $(function () {

            $("#Msg").html("<img src=../../../Img/loading.gif />&nbsp;正在加载,请稍后......");

            //求出来已经设置的延续子流程.
            var nodeID = GetQueryString("FK_Node");
            var ens = new Entities("BP.WF.Template.SFlow.SubFlowYanXus");
            ens.Retrieve("FK_Node", nodeID, "SubFlowType", 2, "Idx");

            var node = new Entity("BP.WF.Node", nodeID);
            node.SetPara("SubFlowYanXuNum", ens.length);
            node.Update();

            $("#Btn_AddGroup").hide();
            var webUser = new WebUser();
            if (webUser.CCBPMRunModel == 1) {
                $("#Btn_AddGroup").show();
            }

            //console.log(ens);

            var html = "";
            for (var i = 0; i < ens.length; i++) {
                var en = ens[i];
                html += "<tr>";
                html += "<td class=Idx>" + (i + 1) + "</td>";
                html += "<td>" + en.SubFlowNo + "</td>";
                html += "<td>" + en.SubFlowName + "</td>";
                html += "<td>" + en.SubFlowModelText + "</td>";

                html += "<td>" + en.SubFlowStaText + "</td>";


                html += "<td><a href=\"javascript:SetCond('" + en.MyPK + "');\" >设置条件</a></td>";



                //  html += "<td>" + en.YGWorkWayText + "</td>";
                html += "<td><a href=\"javascript:Edit('" + en.MyPK + "');\" >编辑</a></td>";
                html += "<td><a href=\"javascript:Delete('" + en.MyPK + "');\" >删除</a></td>";
                html += "<td>";
                html += "<a href=\"javascript:DoUp('" + en.MyPK + "')\">上移</a> - <a href=\"javascript:DoDown('" + en.MyPK + "')\">下移</a>";
                html += "</td>";
                html += "</tr>";
            }

            $("#Table1 tr:last").after(html);

            $("#Msg").html("");

        });

        function DoUp(mypk) {
            var en = new Entity("BP.WF.Template.SFlow.SubFlowYanXu", mypk);
            en.DoMethodReturnString("DoUp");
            Reload();
        }
        function DoDown(mypk) {
            var en = new Entity("BP.WF.Template.SFlow.SubFlowYanXu", mypk);
            en.DoMethodReturnString("DoDown");
            Reload();
        }

        //查询集团的流程.
        function AddGroup() {
            var webUser = new WebUser();

            var url = "SubFlowYanXuDtl.htm?FK_Node=" + GetQueryString("FK_Node") + "&OrgNo=" + webUser.GroupNo;
            OpenEasyUiDialogExt(url, "选择子流程", 700, 600, true);
        }
        //查询集团的流程.
        function AddOrg() {
            var webUser = new WebUser();
            var url = "SubFlowYanXuDtl.htm?FK_Node=" + GetQueryString("FK_Node") + "&OrgNo=" + webUser.OrgNo;
            OpenEasyUiDialogExt(url, "选择子流程", 700, 600, true);
        }

        //删除成功.
        function Delete(pk) {

            if (confirm('您确定要删除吗？') == false)
                return;

            var en = new Entity("BP.WF.Template.SFlow.SubFlowYanXu", pk);
            en.Delete();
            Reload();
        }

        //设置子流程启动条件.
        function SetCond(pk) {
            var en = new Entity("BP.WF.Template.SFlow.SubFlowAuto", pk);
            var url = "../../Cond2020/List.htm?CondType=3&FK_Flow=" + en.FK_Flow + "&FK_MainNode=" + en.FK_Node + "&FK_Node=" + en.FK_Node + "&ToNodeID=" + en.FK_Node + "&SubFlowNo=" + en.SubFlowNo;
            //  SetHref(url);
            OpenEasyUiDialogExt(url, '设置条件', 700, 600, true);
            return;
        }

        //编辑.
        function Edit(pk) {

            var url = "../../../Comm/RefFunc/EnOnly.htm?EnName=BP.WF.Template.SFlow.SubFlowYanXu&PKVal=" + pk;

            // OpenEasyUiDialogExt(url, '编辑', 700, 500, true);
            OpenEasyUiDialogExt(url, '编辑', 900, 800, true);

            //window.location.href = filterXSS(url);

        }
        function Help() {
            var url = "https://gitee.com/opencc/JFlow/wikis/pages/preview?sort_id=3982375&doc_id=31094";
            window.open(url);
        }
    </script>
</head>
<body>
    <div class="container-full">
        <div class="attrnode-bar-header">
            <span class="pull-right">

                <button id="Btn_AddGroup" name="Btn_AddGroup" onclick="AddGroup();">增加集团子流程</button>
                <button id="Btn_AddMyOrg" class="cc-btn-tab btn-batch" name="Btn_AddMyOrg" onclick="AddOrg();">增加本组织子流程</button>
                <button id="Btn_Help" name="Btn_Help" onclick="Help();">帮助</button>

            </span>
            <strong>
                延续子流程
            </strong>
        </div>

        <table id="Table1" class="table" style="width: 95%">
            <tr>
                <th>
                    序
                </th>
                <th>
                    编号
                </th>
                <th>
                    流程名称
                </th>
                <th>
                    运行模式
                </th>


                <th>
                    状态
                </th>
                <th>
                    条件
                </th>
                <th colspan="2">
                    操作
                </th>
                <th>
                    顺序
                </th>
            </tr>
        </table>
        <br />

        <div style="position:relative;" id="Msg">
        </div>
        <!--
        <fieldset>
                        <legend>填写帮助</legend>
                        <ul>
                            <li>延续流程就是当前的子流程.</li>
                            <li>延续流程是子流程的一种,该子流程只能被发起一次.</li>
                        </ul>
                    </fieldset>-->

        <fieldset id="help">
            <legend>运行效果</legend>

            <br />

            <h3>运行图</h3>
            <img src="SubFlowYanXu-1.png" class="HelpImg" style="width:50%" />
            <h3>流程图</h3>
            <img src="SubFlowYanXu-2.png" class="HelpImg" style="width:50%" />

        </fieldset>
    </div>
</body>
</html>
